package com.ljy.job.test;

import org.junit.jupiter.api.Test;

/**
 * @program: webMagic-job
 * @description: 转换薪水
 * @author: liangjiayy
 * @create: 2022-01-30 16:56
 **/
public class parseSalary {
    @Test
    void t(){
        String s= "1.8 - 24千/年 ";
        s = s.replaceAll(" ","");
        int len = s.length();
        String[] minMax = s.substring(0, len - 3).split("-");
        double min = Double.parseDouble(minMax[0]);
        double max = Double.parseDouble(minMax[1]);

        String[] danWei = s.substring(len-3).split("/");
        if ("千".equals(danWei[0])){
            min *= 1000;
            max *= 1000;
        }else if("万".equals(danWei[0])){
            min *= 10000;
            max *= 10000;
        }else {
            System.out.println(-1);
        }

        if ("月".equals(danWei[1])){

        }else if("年".equals(danWei[1])){
            min /= 12;
            max /= 12.0;
        }else {

        }

        System.out.println((int)min);
        System.out.println((int)max);

    }
}
